﻿using System.Web.Mvc;
using Framework.Domain;

namespace Framework.Mvc.Controllers
{
    /// <summary>
    /// 验证码的控制器
    /// </summary>
    public class VerifyCodeController : Controller
    {
        /// <summary>
        /// 创建图片验证
        /// </summary>
        public FileContentResult CreateImageCode()
        {
            var verifyCode = VerifyCodeHelper.CreateVerifyCode(4);
            Session["LogOnVerifyCode"] = verifyCode;
            var ms = VerifyCodeHelper.CreateImageStream(verifyCode);
            return File(ms.GetBuffer(), "image/JPEG");
        }
    }
}